<?php

	$db = new SQLiteDatabase('InstantInput.db');
	$classes = array();
	
	$result = $db->query("SELECT * FROM Classes");

	while ($result->valid()) 
	{
		$curr = $result->current();

		$class = array(
			"uniqueCourseNumber"=> $curr['class_id'],
			"course"=>stripcslashes($curr['course']),
			"title"=>stripcslashes($curr['title']),
			"startTime"=>$curr['start_time'],
			"endTime"=>$curr['end_time'],
			"days"=>array("F"),
			"location"=>$curr['location']
		);
		
		$classes[] = $class;
		$result->next();	
	}	

	// return it in JSON form
	print json_encode($classes);
?>